//
//  QYGMainCellFrameModel.m
//  wawaji_ios
//
//  Created by 奇艺果 on 2018/1/24.
//  Copyright © 2018年 yiguo qi. All rights reserved.
//

#import "QYGMainCellFrameModel.h"
#import "NSString+Utility.h"

@implementation QYGMainCellFrameModel

- (void)setDollListModel:(CMDollListModel *)dollListModel{
    _dollListModel = dollListModel;
    _mainCellWith = homFlowWith;
    _mainCellHeight = homFlowWith * 1.21;
    
    //1.头像
    CGFloat goodsImageViewX = 0;
    CGFloat goodsImageViewY = 0;
    CGFloat goodsImageViewW = _mainCellWith;
    CGFloat goodsImageViewH = _mainCellWith * 0.85;
    _goodsImageViewF = CGRectMake(goodsImageViewX, goodsImageViewY, goodsImageViewW, goodsImageViewH);
    
    //2.设备名称
    CGFloat nameLabelX = ScaleW(10);
    CGFloat nameLabelY = goodsImageViewH + ScaleW(10);
    CGFloat nameLabelW = goodsImageViewW - ScaleW(10) * 2;
    CGFloat nameLabelH = ScaleW(13);
    _nameLabelF = CGRectMake(nameLabelX, nameLabelY, nameLabelW, nameLabelH);
    
    //3.价格
    
    NSString *priceStr = [NSString stringWithFormat:@"%ld金币/次",dollListModel.coin];
    CGSize priceLabelSize = [priceStr sizeWithFont:ScaleFont(12) maxSize:CGSizeMake(CGFLOAT_MAX, ScaleW(13))];
    CGFloat priceLabelW = priceLabelSize.width;
    CGFloat priceLabelH = ScaleW(13);
    CGFloat priceLabelX = goodsImageViewW - ScaleW(10) - priceLabelW;
    CGFloat priceLabelY = CGRectGetMaxY(_nameLabelF) + ScaleW(10);
    _priceLabelF = CGRectMake(priceLabelX, priceLabelY, priceLabelW, priceLabelH);
   
    //4.金币图片
    
    CGFloat priceImageViewW = ScaleW(12);
    CGFloat priceImageViewH = ScaleW(12);
    CGFloat priceImageViewX = priceLabelX - priceImageViewW - ScaleW(2);
    CGFloat priceImageViewY = priceLabelY;
    _priceImageViewF = CGRectMake(priceImageViewX, priceImageViewY, priceImageViewW, priceImageViewH);
    
    
    //5.设备名称
    CGFloat deviceLabelX = nameLabelX;
    CGFloat deviceLabelY = priceLabelY;
    CGFloat deviceLabelW = priceImageViewX - deviceLabelX;
    CGFloat deviceLabelH = priceLabelH;
    _deviceLabelF = CGRectMake(deviceLabelX, deviceLabelY, deviceLabelW, deviceLabelH);
    
    
    //6.状态
    CGFloat stateLabelW = ScaleW(45);
    CGFloat stateLabelH = ScaleW(18);
    CGFloat stateLabelX = goodsImageViewW - ScaleW(10) - stateLabelW;
    CGFloat stateLabelY = ScaleW(10);
    _stateLabelF = CGRectMake(stateLabelX, stateLabelY, stateLabelW, stateLabelH);
    
    
}
@end
